/**
 *
 */
package top.snoweagle.simple.console.web.context;

import javax.servlet.ServletContext;

import top.snoweagle.simple.console.web.enums.AppEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.web.context.WebApplicationContext;

import java.util.ResourceBundle;

/**
 *应用启动注册类
 */
public class ApplicationContextRegister implements ApplicationContextAware {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		WebApplicationContext wc = (WebApplicationContext) applicationContext;
		ServletContext sc = (ServletContext) wc.getBean(WebApplicationContext.SERVLET_CONTEXT_BEAN_NAME);

        ResourceBundle rb = ResourceBundle.getBundle("META-INF/config/security");
        sc.setAttribute(AppEnum.SECURITY_CONFIG.getCode(), rb);



        logger.debug("[ 初始化环境信息 ]");


	}

}
